home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
dskut
/
reform15.zip
/
REFORMAT.PAS
< prev
Wrap
Pascal/Delphi Source File
|
1987-05-23
|
22KB
|
542 lines
(*
To: INFO-IBMPC-REQUEST@USC-ISIB.ARPA
From: U001222%HNYKUN11.BITNET@WISCVM.WISC.EDU
Subject: reformat.pas
*)
PROGRAM reformat;
{
Program to reformat any disk attached to an Olivetti PC or compatible.
The progam will work well on any MS/PC-DOS machine running under DOS
versions 2.00 up to and including 3.10. Fixed disks up to 32 Meg.
V1.50 Extensions made for big FATs. WORD.INC included for handling of
word integers. MS-DOS function INT21 / 32H used for drive information.
Corrected the problem of DOS losing track of the current directory.
The program has been tested under DOS 2.00 thru 3.10
It will probably work under DOS 3.20 too, but this version will not
run when you try to do so. If you want to test it with DOS 3.20, look
for the string DOS_Versions (it's somewhere near the end of the program)
in this program, and include that version number into the test.
Please let the author know whether you had success or not.
Jos Wennmacker July 86.
Universitair Rekencentrum
Geert Grooteplein Zuid 41
6525 GA Nijmegen
The Netherlands
BITNET address: U015415 at HNYKUN22
V1.5 Jos added new 16-bit and word code, handling up to 30Meg
hard disks, etc. I cleaned up the integer math inline procedures
a little.
David Kirschbaum, Toad Hall
V1.23 Added FRAMER.INC, WRITEF.INC for framing, fast screen write,
fast screen line clear. Tightened up displays a little.
This version is now VERY PC-specific. Generic MS-DOS functions
for screen stuff to follow.
David Kirschbaum, Toad Hall.
V1.22 Added inline code to replace the INT25.ASM and INT26.ASM
files.
David Kirschbaum, Toad Hall, 3 May 86
V1.21(mod) not publicly released. Changes made by Rick Watson to let
the program recognize the big (16 bit) FATs. He made it run on 20 Meggers
under DOS 3.x. Martin Hobson made it run on 30 Meggers under DOS 3.x.
May 86.
V1.21 Small corrections made to avoid Turbo integer overflow. (Hey,
Borland, what about a WORD type in Turbo, would be very usefull using
the MSDOS features!).
V1.20 First release to the public domain.
What started as a favour to a friend grew into a nice program.
Do you like it? Let me know about it! If I know many people to use it,
I'll keep it up to date, and send you new releases.
Jos Wennmacker
}
{$C-}
{-------------------------------- Global types -------------------------------}
TYPE
{------------------- types for word arithmetic see REFORMAT.IN1 -------------}
word = INTEGER;
Relational_Operator = (Eq, Gt, Lt, Ne, Ge, Le);
{------------------------ for interrupts and DOS calls -----------------------}
Regpack =
RECORD CASE INTEGER OF
1: (ax, bx, cx, dx, bp, si, di, ds, es, flags : word);
2: (al, ah, bl, bh, cl, ch, dl, dh : Byte);
END;
{----------------------------- Bootrecord layout -----------------------------}
Boot = { the layout of the DOS boot record }
RECORD
Jump: ARRAY[0..2] OF Byte; { Near jump to boot code }
OEM : ARRAY[0..7] OF CHAR; { eight character OEM name }
sectorSize: word; { number of bytes in one sector }
clusterSize: Byte; { sectors per cluster }
reservedSectors: word; { DOS boot code sector(s) typically 1 }
numberOfFATs: Byte; { usually 2, but often 1 for RAM disks }
rootDirSize, { maximum entries in root directory }
totalSectors: word; { total sectors in the logical image }
mediaDescriptor: Byte; { A limited description of the drive
bit 0 = 1: twosided, 0: not two-sided
bit 1 = 1: 8-sector, 0: not 8-sector
bit 2 = 1: removable 0: not removable
bits 3-7 must be set to 1 }
fatSize, { number of sectors in each FAT copy }
trackSize, { number of sectors per track }
numberOfHeads, { number of heads }
hiddenSectors: word; { sectors hidden from DOS, preceding
the DOS partition: including the
master boot record and any non-DOS
partitions }
END;
{---------------- Layout of DOS function 32h disk parameter block ------------}
Parms_32 = ^Parameter_table;
Parameter_Table = { layout of the DOS function 32 table }
RECORD
assignedDisk, { 0 = A, 1 = B, ... }
altAD: Byte; { same as above, but 0 for RAM disk }
sectorSize: word; { number of bytes in one sector }
clusterSize_1, { sectors per cluster minus 1 }
numberOfHeads_1: Byte; { number of heads minus 1 }
reservedSectors: word; { DOS boot code sector(s) typically 1 }
numberOfFATs: Byte; { usually 2, but often 1 for RAM disks }
rootDirSize, { maximum entries in root directory }
firstDataSector, { first sector for data storage }
totalDataClusters_1: word; { total data clusters plus 1 }
fatSize: Byte; { number of sectors in each FAT copy }
firstDirectorySector: word; { first sector of the root directory }
DeviceDriverAddress: ^byte; { Far (offset, segment) address of the
DOS device driver for the drive }
mediaDescriptor: word; { A limited description of the drive
only the low order byte is used:
bit 0 = 1: twosided, 0: not two-sided
bit 1 = 1: 8-sector, 0: not 8-sector
bit 2 = 1: removable 0: not removable
bits 3-7 must be set to 1 }
NextParameterTable: Parms_32; { far pointer to next disk table }
currentDirCluster: word; { Starting cluster of current working
directory. According to Glenn Roberts
in his May 86 PC Tech Journal article
"Finding Disk Parameters" this would
only hold for PC DOS 2.00
}
CurrentDirName: ARRAY [0..63] OF CHAR
{
The name of the current working
directory. This does not hold for
DOS 3.x versions. Only for 2.00 }
END;
{-------- Long byte and integerarays for Disk Transfer Area, Fats etc. -------}
intArray = ARRAY[0..32766] OF INTEGER;
buffer = ARRAY[0..32766] OF Byte;
{--------------------- Element of tree of directory entries ------------------}
DirectoryPointer = ^DirectoryEntry;
longInteger = ARRAY[0..1] OF INTEGER;
DirectoryEntry =
RECORD
EntryName: ARRAY[0..10] OF CHAR; { name + extension w/o period
If the first char is $00 then this
entry was never used. Also the next